import Fetch from '@wattjs/network'
import { showToast } from 'vant'
import { APP_ID, BASE_URL, XSRF_HEADER, REQUEST_TIMEOUT } from './config'

const http = new Fetch({
  config: {
    APP_ID,
    BASE_URL,
    XSRF_HEADER,
    REQUEST_TIMEOUT
  },
  withCredentials: true,
  showToast: (content) => {
    // 错误提示
    showToast({
      message: content,
      duration: 2.5
    })
  },
})

export default http
